const { ccclass, property } = cc._decorator;
declare let i18n,DBManager,dbh;
import BaseView from "../../component/BaseView";
import UIHelper = require("../../component/UIHelper");
import PopUIHelper = require("../../utils/PopUIHelper");
import Utils = require("../../utils/Utils");
//留她一个人 关卡13
@ccclass
export default class DeputyKeepAloneView extends BaseView {
    @property(cc.Label)
    lblStep: cc.Label = null;
    @property(cc.Label)
    lblDes: cc.Label = null;
    @property(sp.Skeleton)
    spine:sp.Skeleton = null;

    //恭喜获得
    @property(cc.Node)
    endNode: cc.Node = null;

    _isDone = false;
    _isStart = false;

    onLoad() {
        Utils.audioManager.playBGM("huazhuang/deputyGame/deputyGameBg");
        //@ts-ignore
        this._isStart = this.node.openParam;
        this.lblStep.string = i18n.t("DEPUTY_GAME_STEP_TITLE13");
        this.lblDes.string = i18n.t("DEPUTY_GAME_STEP_DES13");
    };
    onClose(){
        Utils.audioManager.playDefaultBGM();
    };
    onClickTouch(){
        Utils.audioManager.playSound("huazhuang/deputyGame/step_13");
        this.spine.setAnimation(0,"2",false);
        this.spine.setCompleteListener(()=>{
            this.endNode.active = true;
            Utils.audioManager.playSound("huazhuang/deputyGame/pass");
        });
    };
    

    onClickEnd(isSkip){
        let next = this.params.next && this.params.next.shift();
        if (next) {
            UIHelper.openUI(next, {
                next: this.params.next
            })
            this.node.destroy();
        }
    };
    
    onClickSkip(){
        this.onClickEnd(true);
    };

    //提示
    onClickTips(){
        PopUIHelper.helper.showNewConfirmMsg(i18n.t("DEPUTY_GAME_TIPS13"));
    };
    
    
}
